<?php

class Order extends AppModel {
	var $name = "Order";
	var $useTable = "order_mst";
	var $primaryKey = 'id';
	var $belongsTo = array(
		
		'Job'=>array(
			'className'=>'Job', 'conditions'=>"", 'order'=>'', 
			'foreignKey'=>'job_id' 
		), 
		'Company'=>array(
			'className'=>'Company', 'conditions'=>"", 'order'=>'', 
			'foreignKey'=>'company_id' 
		) 
	);
	
	//@author wangyuhua 2012/4/3 start 下载履历参数加密
	function encodeParam($downfile) {
		$encrypt = new EncryptComponent();
		$encrypt->encode($downfile);
		return $downfile;
	}
	
	//下载履历参数解密
	function decodeParam($param) {
		$encrypt = new EncryptComponent();
		$encrypt->decode($param);
		return $param;
	}
	//@author wangyuhua 2012/4/3 end
	
	function getExcelCol() {
		$col_name = array(
			'Order/member_id'=>'会員番号', 'Order/name_kanji'=>'氏名（漢字）', 
			'Order/name_kana'=>'氏名（カナ）', 'Order/sex'=>'性 別', 
			'Order/nationality'=>'国 籍', 'Order/nation_address'=>'現在の住所（国）', 
			'Order/city_address'=>'現在の住所（県・省）', 
			'Order/other_address'=>'現在の住所（その他）', 'Order/birthday'=>'生年月日', 
			'Order/work_type1'=>'経験職種１', 'Order/work_type2'=>'経験職種2', 
			'Order/work_type3'=>'経験職種3', 'Order/interest_work_type1'=>'興味のある職種1', 
			'Order/interest_work_type2'=>'興味のある職種2', 
			'Order/interest_work_type3'=>'興味のある職種3', 'Order/education'=>'最終学歴', 
			'Order/status'=>'現在の仕事状況', 'Order/member_grad_date'=>'卒業予定', 
			'Order/note'=>'備考', 'Order/member_email'=>'メールアドレス', 
			'Order/language'=>'語学資格レベル' 
		);
		return $col_name;
	}
	function Order_valid($Valid, $params) {
		$message = '';
		$message .= $Valid->ErrorMsg($params, 'Order/work_type', 'required');
		$message .= $Valid->ErrorMsg($params, 'Order/work_type', 'mbmaxlength', 
			'40');
		$message .= $Valid->ErrorMsg($params, 'Order/work_location', 'required');
		$message .= $Valid->ErrorMsg($params, 'Order/work_location', 
			'mbmaxlength', '40');
		$message .= $Valid->ErrorMsg($params, 'Order/comment',
				'mbmaxlength', '500');		
		return $message;
	}
	
	function dodelete($order_id) {
		$sql = "update order_mst SET deleted=now() WHERE id=$order_id";
		$this->query($sql);
	}
}
?>
